<template>
	<view id="content" class="content bgc-f0">
		<view class="p26 bgc-fff search_sticky">
			<u-search 
				placeholder="请输入产品名称" 
				v-model="value" 
				shape="round" 
				@blur="getOrderList" 
				@search="getOrderList" 
				@custom="getOrderList"
			>
			</u-search>
		</view>
		<view class="p20">
			<template v-if="orderList.length > 0">
				<view class="list br12 mb20" v-for="(item,index) in orderList" :key="index"
					@click.stop="handInfo(item.productId)">
					<view class="p20 fs26 z-flex z-flex-align-c">
						<u-image :src="item.productCover" width="110" height="110" border-radius="6"></u-image>
						<view class="flex-1 z-flex z-flex-around ml20" style="flex-direction: column;height: 110rpx;">
							<view class="c-333"><text>{{item.productName}}</text></view>
							<view class=""><text class="c-red fs26">￥</text><text class="fs30 ml6 fwb c-red">{{item.amount}}</text></view>
						</view>
					</view>
				</view>
			</template>
		</view>
		<vempty type="data" v-if="datalen" title="暂无数据"></vempty>
	</view>
</template>

<script>
	import { orderListApi } from '@/api/order.js'
	export default {
		data() {
			return {
				orderList: [],
				datalen: false,
				value: '',
				query: {
					businessId: uni.getStorageSync('businessId')
				}
			}
		},
		onShow() {
			// this.handTabchange(0)
			this.getOrderList()
		},
		methods: {
			async getOrderList(){
				uni.showLoading({
					title: '数据加载中...'
				})
				const {code,data} = await orderListApi(this.query)
				uni.hideLoading()
				if(code != 0) return
				this.orderList = data.list
				this.datalen = data.count == 0
			},
			handInfo(id) {
				uni.$u.route({
					type: 'navigateTo',
					url: 'mapPages/shop_info/index',
					params: {
						id
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		.list {
			background-color: #FFFFFF;
		}
	}
</style>
